<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>leaves</title>
</head>
<body>
<form action="">
    <select name="status" id="status">
    {% if status == -1 %}
        <option value="-1" selected>选择类型</option>
        {% else %}
        <option value="-1">选择类型</option>

    {% endif %}

        {% for foo in leave_types %}

            {% if status == foo.0 %}
                <option value="{{ foo.0 }}" selected>{{ foo.1 }}</option>
                {% else %}
                    <option value="{{ foo.0 }}" >{{ foo.1 }}</option>

            {% endif %}
        {% endfor %}
    </select>
    <input type="submit" value="过滤">

</form>


<form action="" method="get">

{#    <select name="status" id="status">#}
{#    {% if status == '-1' %}#}
{#        <option value="-1" selected>选择类型</option>#}
{#    {% else %}#}
{#        <option value="-1">选择类型</option>#}
{#    {% endif %}#}
{##}
{#        {% for leaf in leaves_type %}#}
{#            <option value="{{ leaf.id }}">{{ leaf.g_leave }}--({{ leaf.s_leave_set.all.count }})</option>#}
{##}
{#        {% endfor %}#}
{##}
{##}
{#    </select>#}
{#        <input type="submit" value="过滤">#}
            <table border="4">
                <tr>
                    <td style="text-align: center">编号</td>
                    <td style="text-align: center">姓名</td>
                    <td style="text-align: center">事由</td>
                    <td style="text-align: center">状态</td>
                    <td style="text-align: center">类型</td>
                    <td style="text-align: center">操作</td>

                </tr>
    {% for leaves_re in leaves_res %}

        <tr>
            <td>{{ leaves_re.0 }}&nbsp;&nbsp;</td>
            <td>{{ leaves_re.1 }}&nbsp;&nbsp;</td>
            <td>{{ leaves_re.4 }}&nbsp;&nbsp;</td>
            <td>{% if leaves_re.2 == 0 %}
                待审核
                {% elif leaves_re.2 == 1 %}
                通过
                {% elif leaves_re.2 == 2 %}
                不通过

            {% endif %} </td>

            <td>{{ leaves_re.5 }}&nbsp;&nbsp;</td>

            <td><a href="{% url 'leave:update_leave' %}?id={{ leaves_re.0}}&status=1">通过</a>
            <a href="{% url 'leave:update_leave' %}?id={{ leaves_re.0 }}&status=2">不通过</a></td>

    <br>
    </tr>

{% endfor %}
</table>
{% if page > 1%}
    <a href="{% url 'leave:show_leaves' %}?page={{ page|add:-1 }}&status={{ status }}">上一页</a>
{% endif %}
<b><a href="#">当前页{{ page }}</a></b>
{% if page < max_z%}
    <a href="{% url 'leave:show_leaves' %}?page={{ page|add:1 }}&status={{ status }}">下一页</a>

{% endif %}

</form>
</body>
</html>